﻿using System;
using System.Data;
using System.Web;
using System.Web.SessionState;
/// <summary>
///PaginationDataLister 的摘要说明
/// </summary>
public class PaginationDataLister
{
    public IDataTableStringFormater formater;
    public IPaginationList dataList;
    
	public PaginationDataLister(IPaginationList lister)
	{
        dataList = lister;
        formater = new JsonFormater();
	}
    public PaginationDataLister(string webpagename, HttpRequest Request, HttpSessionState Session)
    {
        IntialIPaginationList(webpagename, Request, Session);
        formater = new JsonFormater();
    }
    public string GetEasyUIDataGridJson()
    {
        if (dataList == null | formater==null) return "";

        DataTable dt= dataList.GetPaginationData();
        string json= formater.Format(dt);
        json = Tools.ToEasyUIDataGridJson(json, dataList.GetTotalCount());
        return json;  
    }

    public void  IntialIPaginationList(string webpagename,HttpRequest Request,HttpSessionState Session)
    {
        IPaginationList listData = null;
        switch (webpagename.Trim().ToLower())
        {
           
            case "zxgztj_pg":
                listData = new ZXGZTJ_SS(Request,Session);
                break;
            case "zxgztj_bm":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_cf":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_dj":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_fk":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_jl":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_ky":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_pm":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_xz":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_lx":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_fzys":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
            case "zxgztj_blkf":
                listData = new ZXGZTJ_SS(Request, Session);
                break;
        }
        dataList = listData;
    }
   
}
